package cn.bin758.h5game.module.game.dal.mysql.users;

import java.util.*;

import cn.bin758.h5game.framework.common.pojo.PageResult;
import cn.bin758.h5game.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.bin758.h5game.framework.mybatis.core.mapper.BaseMapperX;
import cn.bin758.h5game.module.game.dal.dataobject.users.GameUsersDO;
import org.apache.ibatis.annotations.Mapper;
import cn.bin758.h5game.module.game.controller.admin.users.vo.*;

/**
 * 玩家信息 Mapper
 *
 * @author bin758
 */
@Mapper
public interface GameUsersMapper extends BaseMapperX<GameUsersDO> {

    default PageResult<GameUsersDO> selectPage(GameUsersPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GameUsersDO>()
                .likeIfPresent(GameUsersDO::getUsername, reqVO.getUsername())
                .likeIfPresent(GameUsersDO::getNickname, reqVO.getNickname())
                .eqIfPresent(GameUsersDO::getRemark, reqVO.getRemark())
                .eqIfPresent(GameUsersDO::getSex, reqVO.getSex())
                .eqIfPresent(GameUsersDO::getStatus, reqVO.getStatus())
                .orderByDesc(GameUsersDO::getId));
    }

    default List<GameUsersDO> selectList(GameUsersExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<GameUsersDO>()
                .likeIfPresent(GameUsersDO::getUsername, reqVO.getUsername())
                .likeIfPresent(GameUsersDO::getNickname, reqVO.getNickname())
                .eqIfPresent(GameUsersDO::getRemark, reqVO.getRemark())
                .eqIfPresent(GameUsersDO::getSex, reqVO.getSex())
                .eqIfPresent(GameUsersDO::getStatus, reqVO.getStatus())
                .orderByDesc(GameUsersDO::getId));
    }

}
